<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.example.onlineeducationplatform.model.User" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>用户信息</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f2f2f2;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .user-card {
            background-color: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
            width: 300px;
        }
        h2 {
            text-align: center;
            margin-bottom: 20px;
        }
        input[type="text"],
        input[type="password"],
        input[type="email"] {
            width: 90%;
            padding: 10px;
            margin: 8px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            padding: 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            width: 100%;
            margin: 5px 0;
        }
        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>

<div class="user-card">
    <h2>用户信息</h2>
    <form action="/user/update" method="post">
        <input type="hidden" name="id" value="${user.id}"/>

        <label for="username">用户名:</label>
        <input type="text" id="username" name="username" value="${user.username}" required>

        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="${user.password}" required>

        <label for="email">电子邮件:</label>
        <input type="email" id="email" name="email" value="${user.email}" required>

        <button type="submit">提交修改</button>
    </form>
    <form action="/user/delete" method="post">
        <input type="hidden" name="id" value="${user.id}"/>
        <button type="submit">删除用户</button>
    </form>
    <button type="button" onclick="window.location='/index.jsp'">登出</button>
</div>

</body>
</html>
